package servise;

import java.util.List;

import dao.CodeDao;

import pojo.TblAdvertAddress;
import pojo.Tbldeftype;
import pojo.advert.TblAdvert;

public class DefCodeService {
	public List<TblAdvert> findActiveAdvertLeft(){
		List<TblAdvert> tblAdvertList;
		String hql = "from TblAdvert where id not in( select id.advertId from TblActiveAdvert taa )";
		CodeDao codeDao = new CodeDao();
		tblAdvertList = codeDao.findActiveAdvert(hql);
		return tblAdvertList;
	}
	public List<TblAdvert> findActiveAdvertRight(){
		List<TblAdvert> tblAdvertList;
		String hql = "from TblAdvert where id in( select id.advertId from TblActiveAdvert taa )";
		CodeDao codeDao = new CodeDao();
		tblAdvertList = codeDao.findActiveAdvert(hql);
		return tblAdvertList;
	}
	
	public List<TblAdvertAddress> findAdvertAddress(){
		List<TblAdvertAddress> tblAdvertAddressList;
		String hql = "from TblAdvertAddress";
		CodeDao codeDao = new CodeDao();
		tblAdvertAddressList = codeDao.findAdvertAddressByHql(hql);
		return tblAdvertAddressList;
	}
	public List<Tbldeftype> findDefCode(){
		List<Tbldeftype> tbldeftypeList;
		String hql = "from Tbldeftype";
		CodeDao codeDao = new CodeDao();
		tbldeftypeList = codeDao.findDefCodeByHql(hql);
		return tbldeftypeList;
	}

}
